package 选课;

public class XuankeTest {
    public static void main(String[] args) {
        //课程实例化
     
        Course xxds=new Course("001","线性代数","教102","周二8：00——9：40");
        Course java=new Course("002","Java","教201","周三1：30——3：10");
       

        //教师实例化
        Teacher wang=new Teacher("0001","王老师","男", new Course[]{xxds});
        Teacher zhang=new Teacher("0002","张老师","男",new Course[]{java});
        

        //设置课程的教师
       
        xxds.setTeacher(wang);
        java.setTeacher(zhang);
     
      
        
        //学生实例化
        Student liu=new Student("202031101","刘同学","男",new Course[]{xxds});
        Student zhao=new Student("202031002","赵同学","女",new Course[]{java});

        //学生选课操作
        
        liu.xuanke(xxds);
        zhao.xuanke(java);
       
       
        //打印课表
        System.out.println("学生编号:"+liu.number+
                "\n学生姓名:"+liu.name+
                "\n学生性别:"+wang.sex);

        for(int i = 0; i<liu.course.length; i++){
            System.out.println("课程编号:"+liu.course[i].number+"\t课程名称:"+liu.course[i].name+"\t上课时间:"
                    +liu.course[i].time+"\t上课地点:"+liu.course[i].place+"\t教师:"+liu.course[i].teacher.name);
        }

        System.out.println("\n"+"学生编号:"+zhao.number+
                "\n学生姓名:"+zhao.name+
                "\n学生性别:"+zhao.sex);

        for(int i = 0; i<zhao.course.length; i++){
            System.out.println("课程编号:"+zhao.course[i].number+"\t课程名称:"+zhao.course[i].name+"\t上课时间:"
                    +zhao.course[i].time+"\t上课地点:"+zhao.course[i].place+"\t教师:"+zhao.course[i].teacher.name);
        }
    }
}
